import { Component, OnInit } from '@angular/core';
import { changeHoliday } from '../../domain/user'
import { UserService } from 'src/app/service/user.service';
import { Router } from '@angular/router';
@Component({
  selector: 'app-change-holiday',
  templateUrl: './change-holiday.component.html',
  styleUrls: ['./change-holiday.component.css']
})
export class ChangeHolidayComponent implements OnInit {

  constructor(private userService: UserService, private _router: Router) { }

  changeHolidayModel: changeHoliday;

  ngOnInit() {
  }

  changeHolidays(username: string, setDays: number) {
    this.changeHolidayModel = new changeHoliday(username, setDays);
    this.userService.setYearHoliday(this.changeHolidayModel).then(() => {
      this._router.navigateByUrl('/administration-staff-attendance/successful-interface');
    })
  }
}
